{include file="index/header" /}
<link rel="stylesheet" type="text/css" href="__PUBLIC__admin/tankuang.css">
<script type="text/javascript" src="__PUBLIC__admin/UEditor/third-party/SyntaxHighlighter/shCore.js"></script>
<link rel="stylesheet" href="__PUBLIC__admin/UEditor/third-party/SyntaxHighlighter/shCoreDefault.css">
<body>
	<div class="panel admin-panel">
		<div class="panel-head"><strong class="icon-reorder"> 内容列表</strong></div>
		<div class="padding border-bottom">  
			<form method="post" action="" id="listform">
				<ul class="search" style="padding-left:10px;">
					<li> <a class="button border-main icon-plus-square-o" href="{:url('ques_edit')}"> 新增</a> </li>
					<li>搜索：</li>
					<li><select name="nav_id" class="input" style="width:200px; line-height:17px;" onchange="changesearch()">
						<option value="">请选择专业</option>
						{foreach $navData as $nav}
						<option value="{$nav.nav_id}" {if $param.nav_id eq $nav.nav_id}selected{/if}>{$nav.nav_name}</option>
						{/foreach}
					</select></li>
					<li><select name="type_id" class="input" style="width:200px; line-height:17px;"onchange="changesearch()">
						<option value="">请选择阶段</option>
						{foreach $typeData as $type}
						<option value="{$type.type_id}" {if $param.type_id eq $type.type_id}selected{/if}>{$type.type_name}</option>
						{/foreach}
					</select></li>
					<li><select name="s_id" class="input" style="width:200px; line-height:17px;" onchange="changesearch()">
						<option value="">请选择章节</option>
						{foreach $sData as $s}
						<option value="{$s.s_id}" {if $param.s_id eq $s.s_id}selected{/if}>{$s.s_name}</option>
						{/foreach}
					</select></li>
					<li><select name="course_id" class="input" style="width:200px; line-height:17px;"onchange="changesearch()">
						<option value="">请选择课程</option>
						{foreach $courseData as $course}
						<option value="{$course.course_id}" {if $param.course_id eq $course.course_id}selected{/if}>{$course.course_name}</option>
						{/foreach}
					</select></li>
					<li>
						<input type="text" placeholder="请输入搜索关键字" name="stem" class="input" style="width:250px; line-height:17px;display:inline-block" value="{$param.stem}" />
						<a href="javascript:void(0)" class="button border-main icon-search" onclick="changesearch()" > 搜索</a>
					</li>
				</ul>
			</form>
		</div>
		<table class="table table-hover text-center">
			<tr>
				<th>ID</th>
				<th style="text-align: left;width: 300px;">题干</th>
				<th style="text-align: left;">所属视频</th>
				<th style="text-align: left;">最后更新</th>
				<th style="text-align: left;">操作</th>
			</tr>
			{foreach $data as $v}
			<tr>
				<td><input type="checkbox" name="id[]" value="{$v.id}" />{$v.id}</td> 
				<td align="left" width="300">{$v.stem|htmlspecialchars=###}</td>
				<td align="left">{$v.nav_name}<br/>{$v.type_name}<br/>{$v.s_name}<br/>{$v.course_name}</td>
				<td align="left">{$v.updated_admin_id|returnAdminName=###}<br>{$v.updated_time|date="Y-m-d H:i:s",###}</td>
				<td align="left"><div class="button-group">
					<a class="button border-main" href="{:url('ques_edit',['id' => $v['id']])}"><span class="icon-edit"></span> 修改</a>
					<a class="button border-red" href="{:url('ques_del',['id' => $v['id']])}" onclick="if(confirm('确定删除?')==false)return false;"><span class="icon-trash-o"></span> 删除</a>
				</div></td>
			</tr>
			{/foreach}
			<tr>
				<td colspan="4">{$data->render()}</td>
			</tr>
		</table>
	</div>
</body></html>
<script>
//全选
$("#checkall").click(function(){ 
	$("input[name='id[]']").each(function(){
		if (this.checked) {
			this.checked = false;
		}
		else {
			this.checked = true;
		}
	});
});

function changesearch(){
$("#listform").submit();    //提交ID为myform的表单
}

//批量删除
function DelSelect(){
	var Checkbox=false;
	$("input[name='id[]']").each(function(){
		if (this.checked==true) {   
			Checkbox=true;  
		}
	});
	if (Checkbox){
		var t=confirm("您确认要删除选中的内容吗？");
		if (t==false) return false;   
		$('input[name=status]').val('del');
		$("#listform").submit();    
	}
	else{
		alert("请选择您要删除的内容!");
		return false;
	}
}

</script>